﻿using Business.WriteAPI.Application.Breeds;
using Business.WriteAPI.Application.FarmEnterprises;
using Business.WriteAPI.Application.Images;
using Business.WriteAPI.Application.Immunities;
using Business.WriteAPI.Application.Machinings;
using Business.WriteAPI.Application.Products;
using Business.WriteAPI.Application.Slaughtes;
using Common.Services;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Business.WriteAPI.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class ManagementController : ControllerBase
    {
        private readonly IMediator mediator;
        public ManagementController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 新增产品
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        [HttpPost("ProductAdd")]
        public async Task<APIResult> ProductAdd(ProductAddRequestModel model)
        {
            return await mediator.Send(model);
        }
        /// <summary>
        /// 编辑产品
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        [HttpPost("ProductUpd")]
        public async Task<APIResult> ProductUpd(ProductUpdRequestModel model)
        {
            return await mediator.Send(model);
        }
        /// <summary>
        /// 删除产品
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        [HttpPost("ProductDel")]
        public async Task<APIResult> ProductDel(ProductDelRequestModel model)
        {
            return await mediator.Send(model);
        }
        /// <summary>
        /// 新增产品
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        [HttpPost("ProductPhotoAdd")]
        public async Task<APIResult> ProductPhotoAdd(PhotoAddRequestModel model)
        {
            return await mediator.Send(model);
        }
        /// <summary>
        /// 编辑养殖信息
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        [HttpPost("BreedUpd")]
        public async Task<APIResult> BreedUpd(BreedUpdRequestModel model)
        {
            return await mediator.Send(model);
        }
        /// <summary>
        /// 新增免疫
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        [HttpPost("ImmunityAdd")]
        public async Task<APIResult> ImmunityAdd(ImmunityAddRequestModel model)
        {
            return await mediator.Send(model);
        }
        /// <summary>
        /// 删除免疫信息
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        [HttpPost("ImmunityDel")]
        public async Task<APIResult> ImmunityDel(ImmunityDelRequestModel model)
        {
            return await mediator.Send(model);
        }
        /// <summary>
        /// 编辑免疫信息
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        [HttpPost("ImmunityUpd")]
        public async Task<APIResult> ImmunityUpd(ImmunityUpdRequestModel model)
        {
            return await mediator.Send(model);
        }

        /// <summary>
        /// 新增图片表
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        [HttpPost("ImageAdd")]
        public async Task<APIResult> ImageAdd(ImageAddRequestModel model)
        {
            return await mediator.Send(model);
        }
        /// <summary>
        /// 删除数据库图片
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        [HttpPost("DeleteImage")]
        public async Task<APIResult> DeleteImage(ImageDelRequestModel model)
        {
            return await mediator.Send(model);
        }
        /// <summary>
        /// 编辑企业信息
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        [HttpPost("FarmUpd")]
        public async Task<APIResult> FarmUpd(FarmUpdRequestModel model)
        {
            return await mediator.Send(model);
        }
        /// <summary>
        /// 编辑屠宰信息
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        [HttpPost("SlaughteUpd")]
        public async Task<APIResult> SlaughteUpd(SlaughteUpdRequestModel model)
        {
            return await mediator.Send(model);
        }
        /// <summary>
        /// 编辑屠宰企业信息
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        [HttpPost("SlaughteQUpd")]
        public async Task<APIResult> SlaughteQUpd(SlaughteQUpdRequestModel model)
        {
            return await mediator.Send(model);
        }
        /// <summary>
        /// 编辑深加工信息
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        [HttpPost("MachiningUpd")]
        public async Task<APIResult> MachiningUpd(MachiningUpdRequestModel model)
        {
            return await mediator.Send(model);
        }/// <summary>
         /// 编辑原料信息
         /// </summary>
         /// <param name="model">实体</param>
         /// <returns></returns>
        [HttpPost("MaterialUpd")]
        public async Task<APIResult> MaterialUpd(MaterialUpdRequestModel model)
        {
            return await mediator.Send(model);
        }
        /// <summary>
        /// 编辑辅料信息
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        [HttpPost("AccessoriesUpd")]
        public async Task<APIResult> AccessoriesUpd(AccessoriesUpdRequestModel model)
        {
            return await mediator.Send(model);
        }
        /// <summary>
        /// 编辑添加剂信息
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        [HttpPost("AdditiveUpd")]
        public async Task<APIResult> AdditiveUpd(AdditiveUpdRequestModel model)
        {
            return await mediator.Send(model);
        }
        /// <summary>
        /// 编辑包材信息
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        [HttpPost("PackeUpd")]
        public async Task<APIResult> PackeUpd(PackUpdRequestModel model)
        {
            return await mediator.Send(model);
        }
        /// <summary>
        /// 编辑加工企业信息
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        [HttpPost("MachiningJUpd")]
        public async Task<APIResult> MachiningJUpd(MachiningJUpdRequestModel model)
        {
            return await mediator.Send(model);
        }
    }
}
